<template>
	<view class="my-search-container" :style="{'background-color': bgColor}" @click="searchClickHanlder">
		<!--使用view组件模拟input输入框的模式-->
		<view class="my-search-box" :style="{'border-radius': radius + 'px'}">
			<uni-icons type="search" size="17"></uni-icons>
			<text class="placeholder">搜索</text>
		</view>
	</view>
</template>

<script>
	export default {
		name: "my-search",
		//自定义属性
		props:{
			bgColor: {
				type: String,
				default: '#C00000'
			},
			radius:{
				type: Number,
				default: 18 //px
			}
		},
		//获取的数据
		data() {
			return {

			};
		},
		methods:{
			searchClickHanlder(){
				console.log('我在组件内部！')
				this.$emit('click')
			}
		}
	}
</script>

<style lang="scss">
 .my-search-container{
	 // background-color: #C00000;
	 height: 50px;
	 display: flex;
	 align-items: center;
	 padding: 0 10px;
	 
	 
	 .my-search-box{
		 display: flex;
		 align-items: center;
		 justify-content: center;
		 width: 100%;
		 height: 36px;
		 // border-radius: 15px;
		 background-color: #FFFFFF;
		 // margin: 0 5px;
		 // padding: 0 5px;
		 // border: 0 5px;
		 
		 .placeholder{
			 
		 }
	 }
 }
</style>